<#macro url relativeUrl>${springMacroRequestContext.getContextUrl(relativeUrl)}</#macro>

<#macro message code>${springMacroRequestContext.getMessage(code)}</#macro>

<#macro doPagination dataPage relativeUrl searchForm="form:first">
	<div class="pagination">
		<form id="pForm" action="${relativeUrl}" method="post">
			<input type="hidden" name="page.currentPage" value="1" />
			<ul class="pagination">
				<#if dataPage.pageIndex gt 1>    
			    	<li class=""><a href="javascript:void(0)" onclick="doPagination(${dataPage.pageIndex - 1})">上一页</a></li>
			    <#else>
			    	<li class="disabled"><a>上一页</a></li>
				</#if>
				<#list dataPage.indexes as index>
					<#if index == dataPage.pageIndex>
						<li class="active"><a>${index}</a></li>
					<#else>
						<li><a href="javascript:void(0)" onclick="doPagination(${index})">${index}</a></li>
					</#if>
				</#list>
				<#if dataPage.pageCount gt dataPage.pageIndex>    
					<li class=""><a href="javascript:void(0)" onclick="doPagination(${dataPage.pageIndex + 1})">下一页</a></li>
			    <#else>
			    	<li class="disabled"><a>下一页</a></li>
				</#if>
			</ul>
		</form>
		<div class="clear"></div>
	</div>
	<script>
		function doPagination(pageIndex){
			var formNode = $('div.pagination #pForm');
			formNode.find('input[name="page.currentPage"]').val(pageIndex);
			formNode.attr('action',formNode.attr('action') + "?" +  $("${searchForm}").serialize());
			//兼容IE6
			setTimeout(function(){
				formNode.submit();
			});
		}
	</script>
</#macro>

<#macro alert operationResult>
	<#switch operationResult.resultType>
		<#case "SUCCESS">
			<div class="ui-tiptext-container ui-tiptext-container-success">
			    <p class="ui-tiptext ui-tiptext-success">
			        <i class="ui-tiptext-icon iconfont" title="成功">&#xe605;</i>
			        ${operationResult.message}
			    </p>
			</div>
	    <#break>
	     <#case "INFO">
	     	<div class="ui-tiptext-container ui-tiptext-container-question">
			    <p class="ui-tiptext ui-tiptext-question">
			        <i class="ui-tiptext-icon iconfont" title="疑问">&#xe606;</i>
			         ${operationResult.message}
			    </p>
			</div>
	    <#break>
	  	<#case "WARNING">
	  		<div class="ui-tiptext-container ui-tiptext-container-warning">
			    <p class="ui-tiptext ui-tiptext-warning">
			        <i class="ui-tiptext-icon iconfont" title="警告">&#xe602;</i>
			        ${operationResult.message}
			    </p>
			</div>
	    <#break>
	    <#case "DANGER">
	    	<div class="ui-tiptext-container ui-tiptext-container-error">
			    <p class="ui-tiptext ui-tiptext-error">
			        <i class="ui-tiptext-icon iconfont" title="出错">&#xe607;</i>
			       	${operationResult.message}
			    </p>
			</div>
	    <#break>
	  	<#default>		    
	</#switch>
</#macro>